<?php

use think\migration\Migrator;
use think\migration\db\Column;

class PaymentTransactions extends Migrator
{
    public function up()
    {
        $users = $this->table('payment_transactions', array('comment' => '支付事务'));
        $users->addColumn('number', 'string', array('limit' => 36, 'comment' => '支付订单号'))
              ->addColumn('user_id', 'integer', array('limit' => 5, 'comment' => '支付用户id'))
              ->addColumn('type', 'string', array('limit' => 11, 'comment' => '类型'))
              ->addColumn('price', 'integer', array('comment' => '面值'))
              ->addColumn(Column::tinyInteger('status'))
              ->addColumn('created_at', 'timestamp', array('default' => 'CURRENT_TIMESTAMP'))
              ->addColumn('updated_at', 'timestamp', array('null' => true))
              ->save();     
    }

    /**
     * Migrate Down.
     */
    public function down()
    {
        $this->dropTable('payment_transactions');
    }
}
